# -*- coding: utf-8 -*-

"""
Comment:

"""

#name folders to store data
dictt = 'C:/Users/.../Code_Upselling/GroupBookings'
#name folder of code
folder = "C:/Users/.../Code_Upselling/GroupBookings"

#do not change code anymore
import numpy as np
import time
import matlab as ml

nRuns = 10
nEvalWSK = 1
eps = 0.00000001
uphierar = 'F2FnS2S'       

exec(open(r""+folder+"/packages.py").read())
eng = ml.engine.start_matlab() 

Tshare = 0.8
sharepairs = 0.5
szpairs = 2
instance_no = 999
exec(open(r""+folder+"/Instance"+str(instance_no)+".py").read())

segNP_pos = np.array([[[-a,-b]],[[0,0]],[[a/2,b/2]],[[a,b]]]) 
instance_count = 3000
for segNP in segNP_pos:  
    inst = instance_count
    for mode in ['']: 
        boundvec = ['ub'] 
        for nyp in np.array([0]): 
            for bound in boundvec:
                for stinf in np.array([6,2,9]):
                    exec(open(r""+folder+"/bh_cdlp_wo_inf_final.py").read())
                    filepath = dictt+'/' + Name + '_' + str(Tshare) + '_Groups_'+str(sharepairs)+'.mat'
                    scipy.io.savemat(filepath+'.mat',{'Name':Name,'bound':bound,'cap':cap,'cap_overview':cap_overview, \
                                                          'checkcapconst':checkcapconst,'capcon':capcon,'deniedUp':deniedUp,'eps':eps,'inst':inst,'groups':groups,'ppp_and_group':ppp_and_group,
                                                          'nEvalWSK':nEvalWSK,'nRes':nRes,'nRuns':nRuns,'nSegments':nSegments,'OS_run_t':OS_run_t, \
                                                          'nTimeperiods':nTimeperiods,'nyp':nyp,'prices':prices,'revenues_RCS2_run':revenues_RCS2_run,'revenues_UH_run':revenues_UH_run, \
                                                          'revenues_RCS_run':revenues_RCS_run,'revenues_BH_run':revenues_BH_run,'revenues_UH_WSK_run':revenues_UH_WSK_run,'segNP':segNP, \
                                                          'revenues_UP_run':revenues_UP_run,'revenues_UH_newEps_run':revenues_UH_newEps_run, \
                                                          'segLambdas':segLambdas,'segQ':segQ,'segScale':segScale,'stinf':stinf,'time_elapsed_cont':time_elapsed_cont,'uphierar':uphierar,'revenues_optn':revenues_optn})
    instance_count += 1